﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Core;
    using MarketPulse.BusinessLogic.Common.Criteria;

#endregion

namespace MarketPulse.BusinessLogic.Common
{
    /// <summary>
    /// This class represents a read only instance of a Company within the system.
    /// </summary>
    [Serializable]
    [Csla.Server.ObjectFactory("MarketPulse.BusinessLogic.DataAccess.LinqSProcCompanyFactory, DataAccess", "Fetch")]
    public class CompanyInfo : MarketPulseReadOnlyBase<CompanyInfo>
    {

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private CompanyInfo()
            {
            }

        #endregion

        #region Methods

            #region Factory Methods

                /// <summary>
                /// Method used to retrieve a Company info object representing a *client* 
                /// </summary>
                /// <param name="branchGUID">The guid of the Branch to use in retrieving the object</param>
                /// <returns>The populated </returns>
                public static CompanyInfo Fetch(Guid branchGUID)
                {
                    return DataPortal.Fetch<CompanyInfo>(new SingleCriteria<Guid>(branchGUID));
                }

            #endregion

        #endregion

        #region Properties

            #region Association GUID Properties (Foreign Keys)

                /// <summary>
                /// The GUID of the company (BusinessObject) that this Company belongs to 
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> CompanyGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.CompanyGUID);
                /// <summary>
                /// The GUID of the company (BusinessObject) that this Company belongs to 
                /// </summary>
                public Nullable<Guid> CompanyGUID
                {
                    get { return GetProperty(CompanyGUIDProperty); }
                }

                /// <summary>
                /// The GUID of the area (BusinessObject) that this Company is in
                /// </summary>
                public static PropertyInfo<Nullable<Guid>> AreaGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.AreaGUID);
                /// <summary>
                /// The GUID of the area (BusinessObject) that this Company is in
                /// </summary>
                public Nullable<Guid> AreaGUID
                {
                    get { return GetProperty(AreaGUIDProperty); }
                }

                /// <summary>
                /// The parent company that this company lives under
                /// </summary>
                public static PropertyInfo<Guid> ParentCompanyGUIDProperty = RegisterProperty<Guid>(p => p.ParentCompanyGUID);
                /// <summary>
                /// The parent company that this company lives under
                /// </summary>
                public Guid ParentCompanyGUID
                {
                    get { return GetProperty(ParentCompanyGUIDProperty); }
                }

                ///// <summary>
                ///// The corresponding Legacy ID for this Company (from legacy database)
                ///// </summary>
                //public static PropertyInfo<long> LegacyCompanyIDProperty = RegisterProperty<long>(p => p.LegacyCompanyID);
                //public long LegacyCompanyID
                //{
                //    get { return GetProperty(LegacyCompanyIDProperty); }
                //}

            #endregion

            /// <summary>
            /// A human readable name for this Company
            /// </summary>
            public static PropertyInfo<string> CompanyNameProperty = RegisterProperty<string>(p => p.Name);
            /// <summary>
            /// A human readable name for this Company
            /// </summary>
            public string Name
            {
                get { return GetProperty(CompanyNameProperty); }
            }

            /// <summary>
            /// A human readable short name for this Company
            /// </summary>
            public static PropertyInfo<string> CompanyShortNameProperty = RegisterProperty<string>(p => p.ShortName);
            /// <summary>
            /// A human readable short name for this Company
            /// </summary>
            public string ShortName
            {
                get { return GetProperty(CompanyShortNameProperty); }
            }

            ///// <summary>
            ///// A human readable Building name or number
            ///// </summary>
            //public static PropertyInfo<string> BuildingNameOrNumberProperty = RegisterProperty<string>(p => p.BuildingNameOrNumber);
            //public string BuildingNameOrNumber
            //{
            //    get { return GetProperty(BuildingNameOrNumberProperty); }
            //}

            ///// <summary>
            ///// A human readable Address line (number 1 of 5)
            ///// </summary>
            //public static PropertyInfo<string> AddressLine1Property = RegisterProperty<string>(p => p.AddressLine1);
            //public string AddressLine1
            //{
            //    get { return GetProperty(AddressLine1Property); }
            //}

            ///// <summary>
            ///// A human readable Address line (number 2 of 5)
            ///// </summary>
            //public static PropertyInfo<string> AddressLine2Property = RegisterProperty<string>(p => p.AddressLine2);
            //public string AddressLine2
            //{
            //    get { return GetProperty(AddressLine2Property); }
            //}

            ///// <summary>
            ///// A human readable Address line (number 3 of 5)
            ///// </summary>
            //public static PropertyInfo<string> AddressLine3Property = RegisterProperty<string>(p => p.AddressLine3);
            //public string AddressLine3
            //{
            //    get { return GetProperty(AddressLine3Property); }
            //}

            ///// <summary>
            ///// A human readable Address line (number 4 of 5)
            ///// </summary>
            //public static PropertyInfo<string> AddressLine4Property = RegisterProperty<string>(p => p.AddressLine4);
            //public string AddressLine4
            //{
            //    get { return GetProperty(AddressLine4Property); }
            //}

            ///// <summary>
            ///// A human readable Address line (number 5 of 5)
            ///// </summary>
            //public static PropertyInfo<string> AddressLine5Property = RegisterProperty<string>(p => p.AddressLine5);
            //public string AddressLine5
            //{
            //    get { return GetProperty(AddressLine5Property); }
            //}

            ///// <summary>
            ///// A human readable Postal Code
            ///// </summary>
            //public static PropertyInfo<string> PostCodeProperty = RegisterProperty<string>(p => p.PostCode);
            //public string PostCode
            //{
            //    get { return GetProperty(PostCodeProperty); }
            //}

            ///// <summary>
            ///// A general memo field
            ///// </summary>
            //public static PropertyInfo<string> MemoProperty = RegisterProperty<string>(p => p.Memo);
            //public string Memo
            //{
            //    get { return GetProperty(MemoProperty); }
            //}

            ///// <summary>
            ///// The latitude position of this Company
            ///// </summary>
            //public static PropertyInfo<double> LatitudeProperty = RegisterProperty<double>(p => p.Latitude);
            //public double Latitude
            //{
            //    get { return GetProperty(LatitudeProperty); }
            //}

            ///// <summary>
            ///// The longtitude position of this Company
            ///// </summary>
            //public static PropertyInfo<double> LongtitudeProperty = RegisterProperty<double>(p => p.Longtitude);
            //public double Longtitude
            //{
            //    get { return GetProperty(LongtitudeProperty); }
            //}
       
        #endregion
    }
}
